# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Michael Mason <ms13sp@gmail.com>
pkgname=hping3
pkgver=20051105
pkgrel=4
pkgdesc="A ping-like TCP/IP packet assembler/analyzer"
url="http://www.hping.org"
arch="all"
license="GPL-2.0"
options="!check"
makedepends="libpcap-dev tcl-dev"
subpackages="$pkgname-doc"
source="http://www.hping.org/$pkgname-$pkgver.tar.gz
	hping3-bytesex.patch"

builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	default_prepare
	cd "$builddir"
	sed -i -e 's:net/bpf.h:pcap/bpf.h:' libpcap_stuff.c script.c
}

build() {
	cd "$builddir"
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info
	make CC="${CC:-gcc} -fcommon"
}

package() {
	cd "$builddir"
	install -m755 -D hping3 "$pkgdir"/usr/sbin/hping3
	ln -s hping3 "$pkgdir"/usr/sbin/hping
	ln -s hping3 "$pkgdir"/usr/sbin/hping2
	install -m644 -D docs/hping2.8 "$pkgdir"/usr/share/man/man8/hping2.8
	install -m644 -D docs/hping3.8 "$pkgdir"/usr/share/man/man8/hping3.8
}

sha512sums="
3b3faa836e70054c8f9f004d876b7eb5f668b64826a6aaf8ca3685619111d9df4eb494a7d38b83cea6cb5f0bd164956461039bf4f73f7c7e90d80cede639b2b3  hping3-20051105.tar.gz
1e1798e0258048d29c845bb3c5f47fe13d2f6d21970a31baee8ab61b8ba64d81778577b6efb026861a5c54f55454ca263ff5b0f43fca3e33b7338aee1db23ba4  hping3-bytesex.patch
"
